void ConnectTerminals()
{
	struct sockaddr_in	server_addr, client_addr;
	int sin_size;
	
	if((sockfd=socket(AF_INET, SOCK_STREAM, 0)) == -1)
	{
		fprintf(stderr, "Socket error:%s\n\a", strerror(errno));
		exit(1);
	}

	bzero(&server_addr, sizeof(struct sockaddr_in));
	server_addr.sin_family = AF_INET;
	server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
	server_addr.sin_port = htons(PortNumber);

	if(bind(sockfd, (struct sockaddr *)(&server_addr), sizeof(struct sockaddr)) == -1)
	{
		fprintf(stderr, "Bind error:%s\n\a", strerror(errno));
		exit(1);
	}
	
	if(listen(sockfd,5) == -1)
	{
		fprintf(stderr, "Listen error:%s\n\a", strerror(errno));
		exit(1);
	}


	signal(SIGCHLD, SIG_IGN); 

	while(1)
	{
		sin_size = sizeof(struct sockaddr_in);
		if((new_fd=accept(sockfd, (struct sockaddr *)(&client_addr), &sin_size)) == -1)
		{
			fprintf(stderr, "Accept error:%s\n\a", strerror(errno));
			exit(1);
		}

		fprintf(stderr, "Server get connection from %s\n", inet_ntoa(client_addr.sin_addr));
		
		if(fork() == 0)
		{
			close(sockfd);
			Dispatch();
			
			close(new_fd);
			exit(0);
		}
	}
	close(sockfd);
	exit(0);
}
